<?php
class Grupo extends AppModel {

	var $name = 'Grupo';
	var $primaryKey = 'grupo';
	var $validate = array(
		'nombre' => array(
			'isUnique' => array(
				'rule' => 'isUnique',
				'required' => true,
				'message' => 'El nombre del grupo ya existe'),
			'notEmpty' => array(	
				'rule' => 'notEmpty',
				'required' => true,
				'message' => 'El nombre del grupo no puede estar vacio')
			)
		);
	
	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $hasMany = array(
			'User' => array('className' => 'User',
								'foreignKey' => 'grupo_id',
								'dependent' => false,
								'conditions' => '',
								'fields' => '',
								'order' => '',
								'limit' => '',
								'offset' => '',
								'exclusive' => '',
								'finderQuery' => '',
								'counterQuery' => ''
			)
	);
	
	var $actsAs = array('Acl' => array('requester'));
	 
	function parentNode() {
	    return null;
	}
	
	function listaNombreGrupos(){
		$grupos_list=$this->find('list', array('fields'=>'Grupo.nombre'));
		return $grupos_list;
	}
}
?>